﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using DocumentFormat.OpenXml.Packaging;

namespace Exentials.Xoox.Spreadsheet
{
    public class XSharedStrings : XDocumentBase<SharedStringTablePart>
    {
        private XSharedStringTable _sst;

        public XSharedStrings(SharedStringTablePart part)
            : base(part)
        {
            _sst = new XSharedStringTable();
            Document.Add(_sst.GetXElement());
        }

        public int AddString(string value)
        {
            return _sst.Add(value, false);
        }

        public int AddString(string value,bool shared)
        {
            return _sst.Add(value, shared);
        }

        public string GetString(int index)
        {
            return _sst[index].ToString();
        }

    }
}
